home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 1994 February: Tool Chest / Dev.CD Feb 94.toast / Tool Chest / Development Platforms / MPW Related / MPW Interfaces / PInterfaces / Picker.p < prev    next >
Encoding:
Text File  |  1993-09-17  |  2.4 KB  |  92 lines  |  [TEXT/MPS ]

  1. {
  2.     File:        Picker.p
  3.  
  4.     Copyright:    © 1983-1993 by Apple Computer, Inc.
  5.                 All rights reserved.
  6.  
  7.     Version:    System 7.1 for ETO #11
  8.     Created:    Tuesday, March 30, 1993 18:00
  9.  
  10. }
  11.  
  12. {$IFC UNDEFINED UsingIncludes}
  13. {$SETC UsingIncludes := 0}
  14. {$ENDC}
  15.  
  16. {$IFC NOT UsingIncludes}
  17.  UNIT Picker;
  18.  INTERFACE
  19. {$ENDC}
  20.  
  21. {$IFC UNDEFINED UsingPicker}
  22. {$SETC UsingPicker := 1}
  23.  
  24. {$I+}
  25. {$SETC PickerIncludes := UsingIncludes}
  26. {$SETC UsingIncludes := 1}
  27. {$IFC UNDEFINED UsingQuickdraw}
  28. {$I $$Shell(PInterfaces)Quickdraw.p}
  29. {$ENDC}
  30. {$SETC UsingIncludes := PickerIncludes}
  31.  
  32. CONST
  33. MaxSmallFract = $0000FFFF;    {Maximum small fract value, as long}
  34.  
  35. TYPE
  36. { A SmallFract value is just the fractional part of a Fixed number,
  37. which is the low order word.  SmallFracts are used to save room,
  38. and to be compatible with Quickdraw's RGBColor.  They can be
  39. assigned directly to and from INTEGERs. }
  40.  
  41. SmallFract = INTEGER;        { Unsigned fraction between 0 and 1 }
  42.  
  43. { For developmental simplicity in switching between the HLS and HSV
  44. models, HLS is reordered into HSL. Thus both models start with
  45. hue and saturation values; value/lightness/brightness is last. }
  46.  
  47. HSVColor = RECORD
  48.  hue: SmallFract;            {Fraction of circle, red at 0}
  49.  saturation: SmallFract;    {0-1, 0 for gray, 1 for pure color}
  50.  value: SmallFract;            {0-1, 0 for black, 1 for max intensity}
  51.  END;
  52.  
  53. HSLColor = RECORD
  54.  hue: SmallFract;            {Fraction of circle, red at 0}
  55.  saturation: SmallFract;    {0-1, 0 for gray, 1 for pure color}
  56.  lightness: SmallFract;        {0-1, 0 for black, 1 for white}
  57.  END;
  58.  
  59. CMYColor = RECORD
  60.  cyan: SmallFract;
  61.  magenta: SmallFract;
  62.  yellow: SmallFract;
  63.  END;
  64.  
  65.  
  66. FUNCTION Fix2SmallFract(f: Fixed): SmallFract;
  67.  INLINE $3F3C,$0001,$A82E;
  68. FUNCTION SmallFract2Fix(s: SmallFract): Fixed;
  69.  INLINE $3F3C,$0002,$A82E;
  70. PROCEDURE CMY2RGB(cColor: CMYColor;VAR rColor: RGBColor);
  71.  INLINE $3F3C,$0003,$A82E;
  72. PROCEDURE RGB2CMY(rColor: RGBColor;VAR cColor: CMYColor);
  73.  INLINE $3F3C,$0004,$A82E;
  74. PROCEDURE HSL2RGB(hColor: HSLColor;VAR rColor: RGBColor);
  75.  INLINE $3F3C,$0005,$A82E;
  76. PROCEDURE RGB2HSL(rColor: RGBColor;VAR hColor: HSLColor);
  77.  INLINE $3F3C,$0006,$A82E;
  78. PROCEDURE HSV2RGB(hColor: HSVColor;VAR rColor: RGBColor);
  79.  INLINE $3F3C,$0007,$A82E;
  80. PROCEDURE RGB2HSV(rColor: RGBColor;VAR hColor: HSVColor);
  81.  INLINE $3F3C,$0008,$A82E;
  82. FUNCTION GetColor(where: Point;prompt: Str255;inColor: RGBColor;VAR outColor: RGBColor): BOOLEAN;
  83.  INLINE $3F3C,$0009,$A82E;
  84.  
  85.  
  86. {$ENDC} { UsingPicker }
  87.  
  88. {$IFC NOT UsingIncludes}
  89.  END.
  90. {$ENDC}
  91.  
  92.